var resultValidation = new Vue({

    el: "#resultValidation",

    data: {
        //询价表
        offerTable: [],
        //单个列表信息
        offerTable_show: {},


    },
    //提交时间方法
    methods: {
        //跳转详情信息
        showData: function (offerTable_show) {
            debugger
            $("#wrap-left").load("http://" + window.location.host + "/home/PurchaseAndOrdesdetailResultValidation.html", function () {
                purchaseAndOrdersdetailResultVaidation.urchaseAndOrdersdetail = offerTable_show;
            });

        },
        tableRowClassName: function (row, rowIndex) {
            var _this = this;
            if (rowIndex === 1) {
                return 'warning-row';
            } else if (rowIndex === 3) {
                return 'success-row';
            }
            return '';
        },
        Edit2: function (rowIndex, row) {
            if (row.type==='审核通过'||row.type==='结果确认'||row.type==='待完成'||row.type==='已完成') {

            $("#wrap-left").load("http://" + window.location.host + "/home/PurchaseAndOrdesdetailResultValidation.html", function () {
                purchaseAndOrdersdetailResultVaidation.urchaseAndOrdersdetail = row;
            });
        }
        },

        printPurchase: function (rowIndex, row) {
            debugger
            var _this = this;
            _this.purchaseListData = row;
            if (row.type != '申请' && row.type != '待审核') {
                $.post("/home/purchase_orders/selectOrdersById4Excel",
                    {"ordersId": _this.purchaseListData.id},
                    function (data) {
                        //跳转添加采购单清单
                        $("#wrap-left").load("http://" + window.location.host + "/home/PurchaseExcel.html", function () {
                            PurchaseExcel.urchaseAndOrdersdetail = data.data.purchaseOrders;
                        });

                    });
            } else {
                _this.$notify({
                    message: '请注意，该订单还没有被审核，无法打印审核单！',
                    type: 'error'
                });
                return;
            }
        },
        printPurchaseList: function (rowIndex, row) {
            var _this = this;
            debugger
            if (row.type != '申请' && row.type != '待审核') {
                $.post("/home/purchase_orders/selectPurchaseDetailedListAllByOrdersId",
                    {"ordersId": row.id},
                    function (data) {
                        $("#wrap-left").load("http://" + window.location.host + "/home/PurchaseExcelList.html", function () {
                            PurchaseExcelList.ordersDetails = data.data.purchaseDetailedList;
                            PurchaseExcelList.cgdw = row.company_name;
                        });
                    });
            } else {
                _this.$notify({
                    message: '请注意，该订单还没有被审核，无法打印审核单！',
                    type: 'error'
                });
                return;
            }
        },
        excelEdit3: function (rowIndex, row) {
            $("#wrap-left").load("http://" + window.location.host + "/home/memorandInUnitingPring.html", function () {
                purchaseAndOrdersdetailResultVaidation.urchaseAndOrdersdetail = row;
            });
        },


    },

    //页面加载后的初始化方法
    created: function () {
        var _this = this;
        //取得所有满足要求的列表
        $.post("/home/purchase_orders/selectOrdersByCreateUser4ResultValidation", "", function (data) {
            debugger
            _this.offerTable = data.data.purchaseOrders;
        });
    }


});

function tableRowClassName(row, rowIndex) {
    var _this = this;
    if (rowIndex === 1) {
        return 'warning-row';
    } else if (rowIndex === 3) {
        return 'success-row';
    }
    return '';
}
